---
description: "Swift documentation for '=='"
root: "/v5.1"
title: "=="
keywords: ""
layout: "default"
---

<div class="intro-declaration"><code class="language-swift">func ==(t0:t1:)(t0: Any.Type?, t1: Any.Type?) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two types are identical.
</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: T, rhs: T) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the two arguments are equal.
</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (), rhs: ()) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>All arity zero tuples are equal.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B), rhs: (A, B)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 2
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1)
let b = (&quot;a&quot;, 1)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 2)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C), rhs: (A, B, C)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 3
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2)
let b = (&quot;a&quot;, 1, 2)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 3)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C, D), rhs: (A, B, C, D)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 4
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2, 3)
let b = (&quot;a&quot;, 1, 2, 3)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 2, 4)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C, D, E), rhs: (A, B, C, D, E)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 5
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2, 3, 4)
let b = (&quot;a&quot;, 1, 2, 3, 4)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 2, 3, 5)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C, D, E, F), rhs: (A, B, C, D, E, F)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 6
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2, 3, 4, 5)
let b = (&quot;a&quot;, 1, 2, 3, 4, 5)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 2, 3, 4, 6)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(t0:t1:)(t0: Any.Type?, t1: Any.Type?) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two types are identical.
</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: T, rhs: T) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the two arguments are equal.
</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (), rhs: ()) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>All arity zero tuples are equal.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B), rhs: (A, B)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 2
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1)
let b = (&quot;a&quot;, 1)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 2)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C), rhs: (A, B, C)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 3
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2)
let b = (&quot;a&quot;, 1, 2)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 3)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C, D), rhs: (A, B, C, D)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 4
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2, 3)
let b = (&quot;a&quot;, 1, 2, 3)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 2, 4)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C, D, E), rhs: (A, B, C, D, E)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 5
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2, 3, 4)
let b = (&quot;a&quot;, 1, 2, 3, 4)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 2, 3, 5)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: (A, B, C, D, E, F), rhs: (A, B, C, D, E, F)) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the corresponding components of
two tuples are equal.
</p>
<p>For two tuples to compare as equal, each corresponding pair of components
must be equal. The following example compares tuples made up of 6
components:</p>
<pre><code class="language-swift">let a = (&quot;a&quot;, 1, 2, 3, 4, 5)
let b = (&quot;a&quot;, 1, 2, 3, 4, 5)
print(a == b)
// Prints &quot;true&quot;

let c = (&quot;a&quot;, 1, 2, 3, 4, 6)
print(a == c)
// Prints &quot;false&quot;
</code></pre>
</div><div class="intro-declaration"><code class="language-swift">func ==(a:b:)(a: AnyKeyPath, b: AnyKeyPath) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: CodingUserInfoKey, rhs: CodingUserInfoKey) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether the given keys are equal.
</p>
<ul>
<li>parameter lhs: The key to compare against.</li>
</ul>
<ul>
<li>parameter rhs: The key to compare with.</li>
</ul>
</div><div class="intro-declaration"><code class="language-swift">func ==(a:b:)(a: FloatingPointSign, b: FloatingPointSign) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: Int, rhs: Int) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: Int16, rhs: Int16) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: Int32, rhs: Int32) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: Int64, rhs: Int64) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: Int8, rhs: Int8) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: UInt, rhs: UInt) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: UInt16, rhs: UInt16) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: UInt32, rhs: UInt32) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: UInt64, rhs: UInt64) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: UInt8, rhs: UInt8) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div><div class="intro-declaration"><code class="language-swift">func ==(lhs:rhs:)(lhs: UnicodeDecodingResult, rhs: UnicodeDecodingResult) -> Bool</code></div><div class="discussion comment"><p>Returns a Boolean value indicating whether two values are equal.
</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
</div>